<!--微信分享 开始-->
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script type="text/javascript">
    $.getJSON('http://m.hnr.cn/weixin/config?callback=?', {url: window.location.href}, function (data) {
        wx.config({
            debug: false,
            appId: data.appId,
            timestamp: data.timestamp,
            nonceStr: data.nonceStr,
            signature: data.signature,
            jsApiList: ['checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage']
        });
        wxShare();
    });
    function wxShare() {
        var title = "{$title}--映象网";
        var description = "{$head_description}";
        var link = window.location.href;
        var imgUrl = "{if $wxpic!=''}{$wxpic}{elseif $CAT['wxpic']!=''}{$CAT['wxpic']}{elseif $MOD['wxpic']!=''}{$MOD['wxpic']}{else}http://m.hnr.cn/images/share-logo.png{/if}";
        //检测api是否生效
        wx.ready(function () {
            wx.checkJsApi({
                jsApiList: [
                    'getNetworkType',
                    'previewImage'
                ],
                success: function (res) {
                    console.log(JSON.stringify(res));
                }
            });
            //分享给好友
            wx.onMenuShareAppMessage({
                title: title,
                desc: description,
                link: link,
                imgUrl: imgUrl
            });
            //分享到朋友圈
            wx.onMenuShareTimeline({
                title: title,
                desc: description,
                link: link,
                imgUrl: imgUrl
            });
        });
    }
</script>
<!--微信分享 结束-->